var database = require('../../data/data.js');
Page({
  data: {

  },
  onLoad: function () {
    var that = this;
    wx.request({
      url: database.url + '/api/V2/integral/integral_prize',
      method: "POST",
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      data: {
        accessToken: database.accessToken,
        regionName: "other"
      },
      success(res) {
        var re = res.data.data.content
        re.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function (match) {
          var ree = match.replace("<img ", "<img mode='widthFix' style='width:100%;' ")
          re = re.replace(match, ree)
        });
        that.setData({
          detail: re,
          sharetitle: res.data.data.title,
          sharephoto: res.data.data.photo
        })
      }
    })
  },
  onShareAppMessage() {
    var that = this;
    return {
      title: that.data.sharetitle,
      imageUrl: that.data.sharephoto,
      path: '/pages/jiangpin_detail/jiangpin_detail',
      success: function (res) {
        wx.showToast({
          title: '转发成功',
          icon: 'success',
          duration: 1500
        })
      }
    }
  }
})